import type { BaseEnum } from "@/enums/base";

/**
 * 政治面貌枚举
 * 用于标识不同的政治身份状态
 */
export const PoliticsStatus = {
  /**
   * 其他
   */
  Other: {
    code: "Other",
    name: "其他",
    description: "其他政治面貌"
  },

  /**
   * 中共党员
   */
  PartyMember: {
    code: "PartyMember",
    name: "中共党员",
    description: "中国共产党党员"
  },
  
  /**
   * 共青团员
   */
  Teenager: {
    code: "Teenager",
    name: "共青团员",
    description: "中国共产主义青年团团员"
  },

  /**
   * 群众
   */
  Mass: {
    code: "Mass",
    name: "群众",
    description: "人民群众"
  },
} as const;

/**
 * 根据code获取枚举
 * @param code
 * @returns 枚举值或null
 */
export function matchCode(code: string): (typeof PoliticsStatus)[keyof typeof PoliticsStatus] | null {
  return (
    Object.values(PoliticsStatus).find((item) => item.code === code) || null
  );
}

/**
 * 获取所有政治面貌选项
 * @returns 政治面貌数组
 */
export function getPoliticsStatusOptions(): (typeof PoliticsStatus)[keyof typeof PoliticsStatus][] {
  return Object.values(PoliticsStatus);
}
